<script>
import axios from 'axios';
axios.defaults.baseURL = 'http://127.0.0.1:3001';

export default {
    data() {
        return {
            blog: {}
        }
    },
    created() {
        this.fetch()
    },
    methods: {
     fetch() {
        axios.get(`/blogs/${this.$route.params.id}`).then(res => {
            this.blog = res.data
        })
    }
    }
}
</script>
<template>
    <div id="viewblog">
        <h2>{{ blog.title }}</h2>
        <p v-html=blog.body></p>
    </div>
</template>
<style></style>